<?php
	$path_one = 'admin/admin_project';
	$path_two = 'admin/admin_project_manage';
	$filename = 'admin/admin_project_list';
	require_once("header.php");
	require_once("admin_comm.php");
	require_once $_site->get_handlepath('project');
	$page=request('page',false,true,false,1);
	$pagesize=request('pagesize',false,true,false,10);
	$id = request('id',false,true);
	$project_info = project_fun_get_project_info($id);
	if(!$id || !$project_info){		
		location_msg(L('1002'),'/admin/admin_project_list');
	}
	$type=request('type',false,true,false,1);
	$data['type']=$type;
	$data['pid'] = $id;
	$data['state']=$state=request('state',false,true,false,0);
	$data['carno']=$carno=request('carno');
	$result = project_fun_get_project_device_list($data,$page,$pagesize);
	$hover[$data['state']]=' class="hover" ';
?>
<script type="text/javascript" charset="utf-8">

	loader.file({
		plugin:['validform/main','dialog/main'],
		skincss:['list']
	})

</script>
<style>
.dishes_top{width:100%}
.dishes_top a{text-decoration:none}
.dishes_top ul{float:left;width:100%;margin-top:10px}
.dishes_top ul li{display:inline-block;padding:0 5px}
.dishes_top ul li a{display:block;font-size:14px;height:35px;line-height:35px;width:140px;background-color:#eeeeee;color:#454545;font-size:14px;text-align:center}
.dishes_top ul li a:hover{background-color:#79473a;color:#ffffff}
.dishes_top ul li a.hover{background-color:#79473a;color:#ffffff}
.main .btn_submit{color:#FFFFFF; background:#289121;border:1px solid #c4c4c4;border-radius:2px;text-shadow:0 -1px 0 rgba(0, 0, 0, 0.25); border-color:#289121 #289121 #289121;padding:3px 15px;display:inline-block;cursor:pointer;font-size: 12px;}
.main .btn_submit:hover{background:#227E1C;}
</style>
</head>
<body>
	<div class="position_nav">你所在的当前位置：<?php echo $path_str;?> &gt; 项目绑定的设备列表</div>
		<div class="main">
			<div class="power_nav">
			          【<?php echo $project_info['title'];?>】  已绑定的设备
			    <div style="float:right;">
			      <a class="btn_submit" href="/admin/admin_project_bind_device?id=<?php echo $project_info['id'];?>&type=<?php echo $type;?>">绑定设备</a>
			     <!--  <a class="btn_submit" href="/admin/admin_project_bind_device?id=<?php echo $project_info['id'];?>&type=<?php echo $type;?>">导入更新</a> -->
			    </div>         
			    
			</div>
			
			<div class="dishes_top">
			   <ul style="width:60%;">			  			       				     		
				 <li><a<?php echo 1==$type?' class="hover"':'';?> href="/admin/admin_project_device_list?type=1&id=<?php echo $id;?>">工程车管理</a></li>				 				     						   				     		
				 <li><a<?php echo 2==$type?' class="hover"':'';?> href="/admin/admin_project_device_list?type=2&id=<?php echo $id;?>">油料管理</a></li>				 				     						   				     		
			   </ul>	
			   <?php if(1==$type){ ?>
			   <div style="float:right;margin-top:15px;">
			     <form action="/admin/admin_project_device_list" method="get">
			      <input type="hidden" name="type" value="<?php echo $type; ?>">
			      <input type="hidden" name="id" value="<?php echo $id;?>">
			      <input type="text" name="carno" value="<?php echo $carno;?>" placeholder="请输入车牌号码">
			      <input type="submit" class="btn_submit" value="搜索">
			     </form>
			   </div>			  
			   <?php } ?>
			</div>				
			<table cellpadding="0" cellspacing="1" border="0" class="table">
				<tr>
					<th width="10%" align="center">序号</th>
					<th width="15%" align="left">设备号</th>
					<?php if(1==$type){ ?>
					<th width="12%" align="left">车牌号</th>
					<th width="12%" align="left">车型</th>
					<th width="12%" align="left">产权人</th>
					<th width="12%" align="left">电话</th>											
					<?php }else{ ?>
					<th width="12%" align="left">员工编号</th>																								
					<?php } ?>					
					<th width="13%" align="center">添加时间</th>
					<th align="center" style="padding-left: 10px;">操作</th>
				</tr>
				<?php
					if($result['rows']){
						foreach ($result['rows'] as $v){
							?>
							<tr>
								<td align="center"><?php echo $v['id'] ;?></td>
								<td align="left"><?php echo $v['no'] ;?></td>
								<?php if(1==$type){ ?>
								<td align="left"><?php echo $v['car_number'] ;?></td>
								<td align="left"><?php echo $v['cartype'] ;?></td>
								<td align="left"><?php echo $v['linkman'] ;?></td>
								<td align="left"><?php echo $v['phone'] ;?></td>	
								<?php }else{ ?>
								<td align="left"><?php echo $v['gaser'] ;?></td>															
								<?php } ?>																							
								<td align="center"><?php echo date('Y-m-d H:i',$v['time']) ;?></td>
								<td align="center" class="set_text">									
								【<a href="/admin/admin_project_bind_device?id=<?php echo $v['pid']?>&did=<?php echo $v['did']; ?>&bid=<?php echo $v['id'];?>">修改</a>】
								【<a href="/handle.php?h=project/bind_remove&id=<?php echo $v['id']?>&did=<?php echo $v['did']; ?>" onClick="return confirm('确定解除设备的绑定？');">解除绑定</a>】								
								</td>
					</tr>
							<?php
						}
					}else{
						?>
						<tr>
							<td colspan="<?php echo 1==$type?8:5;?>">没有设备信息！</td>
						</tr>
						<?php
					}
				?>
				<tr>
					<td colspan="<?php echo 1==$type?8:5;?>">
						<div class="list_more">
							设备总数：<?php echo $result['row_count']?$result['row_count']:0 ;?>
							<?php
								echo page_method($result['row_count'], $page, $result['page_count'], 10, '?'.preg_replace('/(&page=\d*)/','',$_SERVER['QUERY_STRING']), false);
							?>
						</div>
					</td>
				</tr>
			</table
		></div>
	</div>
</body>
</html>


